Skip to content

Classify section blocks by the shell grammar - #4586

Open
evanchooly wants to merge 1 commit into
audits-version-annotationsfrom
audits-section-roles
Open

evanchooly wants to merge 1 commit into
audits-version-annotationsfrom
audits-section-roles

Conversation

@evanchooly

Copy link
Copy Markdown
Member

Step 1 of retiring the legacy RST extractor. Stacked on #4583.

Problem

The structured scenario extractor is meant to take over the example inventory from the line-based RST extractor, but its section-assembly rules rejected most operator pages:

  • One command, last. A section had to hold exactly one command, in its final input block, followed by one result. A section that showed a syntax template beside the real command (db.collection.updateOne({ <query selector> }, ...)) or ran two queries was rejected.
  • Setup only. A shared Examples section had to contain nothing but setup. 109 of them also show a sample document or template, so every scenario on those pages lost its setup.
  • No seeding. A page that shows the collection as a document ($acos: "Consider a trigonometry collection that contains: { ... }") never became runnable, since a displayed document was never inserted.
  • Labels. The parser leaves code-block options on the language (javascript\n:copyable: true), json-labeled results were refused, and selected-content branches and extract containers made scenarios unresolved.

Over all 297 operator pages, with a draft plan built from each page's own headings, only 250 scenarios normalized, against the 582 examples in the legacy inventory.

Change

SectionPrograms classifies each block by what the shell processor makes of it, read with the setup accepted before it:

Block Role
inserts, indexes, declarations setup for the actions after it
one find, aggregate or update an action: its own scenario
a document right after a read that read's published result
a document where the scenario inserts nothing a seed for the action's collection
anything else skipped, with a reason

Skipped source is kept on the scenario (skipped) or the page (sharedSetupSkipped). The reasons are SYNTAX_TEMPLATE, OPERATOR_EXPRESSION, SAMPLE_DOCUMENT, UPDATE_RESULT, UNREADABLE_RESULT, SEVERAL_COMMANDS, MIXED_SECTION_ROLES, TRAILING_SETUP and UNSUPPORTED_SOURCE.

Other changes:

  • Seeds are settled per scenario, for section-owned and native input/output groups alike, against the setup that scenario actually runs.
  • A seed may use printed constructors such as Decimal128(...). Those are read through the shell-literal grammar when the extended-JSON reader refuses them.
  • selected-content branches are owners, and their selections count toward scenario identity.
  • The plan gains unlabeledLanguage.

design/operator-audits-section-assembly.md and the design overview are updated.

Result

The same 297 pages at docs e4b0c153 now give 598 runnable scenarios, 451 of them with a published result. 508 of the 582 inventory examples match a scenario by title. Of the rest, 14 are examples the generated tests use, and several of those are matcher artifacts, such as titles of "main".

Decisions for review

  • Reversed design rules. This reverses principles the extraction design stated: "no last-action heuristic" and "a displayed sample never becomes an insert". You approved relaxing them. Every block a rule leaves out is recorded with its reason.
  • Results after an update are skipped as UPDATE_RESULT. A read after an update in the same section reports AFTER_EARLIER_WRITE and isn't run alone. Both wait for step 4, where an update's case runs the page's own read.
  • Mixed blocks. A block mixing setup and an action, such as insertOne(...); find(...), is skipped rather than split.
  • The draft plan isn't checked in here. It comes with step 2, which switches the inventory to this extractor and reviews each difference.

Verification

  • The audits suite passes, including 53 ScenarioExtractionTest cases. New cases cover each role, seeding, skipping, selections and the budgets.
  • Three local Codex review rounds found 13 issues, all fixed with regression tests:
    • seed eligibility per action;
    • shared seeds for native groups;
    • selection owners and identity;
    • the language check by position;
    • placeholders inside strings;
    • mixed blocks;
    • the classification prefix limit;
    • group and setup budgets per split scenario;
    • empty selections;
    • reads after an update;
    • captioned results.
  • Copilot CLI was out of quota.

Self-reviewed only: the independent reviewers are out of quota until 2026-11-26.

Section assembly accepted one trailing command and one trailing result
per section, required shared setup to be setup only, and never seeded
from a displayed document. Most operator pages failed one of those
rules, so few had a runnable scenario.

Each block now takes its role from what the shell processor makes of it
alongside the setup before it: setup, an action (its own scenario), the
result printed right after a read, or a candidate seed. Seeds are
settled per scenario against the setup it runs. Syntax templates,
displayed expressions, unreadable results, mixed blocks and similar
source are skipped and recorded with a reason. selected-content
branches are owners and read like tabs; code-block options no longer
stick to the language; JSON-labeled results are accepted.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant